Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract on SubsetCreateMessage #3238

Merged
merged 13 commits into from
Feb 12, 2025

Conversation

rosteen
Copy link
Collaborator

@rosteen rosteen commented Oct 21, 2024

This is meant to be a compatibility patch for glue-viz/glue#2515, but currently isn't working. Opening this PR to share with SMEs @astrofrog @dhomeier. To reproduce the error I mentioned in here, open Cubeviz and try to use the Spectral Extraction plugin.

@rosteen rosteen added this to the 4.1 milestone Oct 21, 2024
@github-actions github-actions bot added the plugin Label for plugins common to multiple configurations label Oct 21, 2024
@@ -262,6 +262,7 @@ def _aperture_items_changed(self, msg):
self._extract_in_new_instance(subset_lbl=subset_lbl,
auto_update=True, add_data=True)
except Exception:
raise
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is here for debugging to expose the error.

Comment on lines +1878 to +2034
self.hub.subscribe(self, SubsetCreateMessage,
handler=lambda msg: self._update_subset(msg.subset))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hoped that I could just replace the trigger for this from SubsetUpdateMessage to SubsetCreateMessage, but it didn't work.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably cannot work as a drop-in replacement since SubsetCreateMessage does not have an attribute (in fact, does nothing). Wondering if this would need something equivalent of LayerSelect._on_subset_created, or if _update_subset can tricked into doing the right action some other way.

Copy link

codecov bot commented Oct 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.53%. Comparing base (937e2bf) to head (ba09ca1).
Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3238   +/-   ##
=======================================
  Coverage   87.53%   87.53%           
=======================================
  Files         128      128           
  Lines       19957    19963    +6     
=======================================
+ Hits        17469    17475    +6     
  Misses       2488     2488           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

subset_id=aperture.selected, cls=StdDevUncertainty
)
except ValueError:
raise
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
raise
msg = SnackbarMessage(
f"Extracting uncertainties on subset for {aperture.selected} failed", # noqa
color='error', sender=self, timeout=10000)
self.app.hub.broadcast(msg)

This would at least let the subset propagate to the spectral extraction tool, even if uncertainties are (initially) missing. I'd expect them to be available after the first modification (move/resize) to the subset, since I don't see the snackbar message repeated then, but could not find anything where nddate.uncertainty is used.

@rosteen rosteen modified the milestones: 4.1, 4.2 Dec 23, 2024
@gibsongreen gibsongreen force-pushed the extract-on-subset-create branch from 2a41bed to c48aa92 Compare January 8, 2025 15:30
@rosteen rosteen force-pushed the extract-on-subset-create branch from c48aa92 to 6b0fa22 Compare January 21, 2025 15:45
@rosteen rosteen marked this pull request as ready for review January 21, 2025 15:48
@rosteen rosteen added no-changelog-entry-needed changelog bot directive and removed Upstream fix required labels Jan 21, 2025
@pllim pllim mentioned this pull request Jan 21, 2025
9 tasks
@pllim pllim mentioned this pull request Jan 21, 2025
9 tasks
@rosteen rosteen force-pushed the extract-on-subset-create branch from bb41b05 to c3ef0b1 Compare January 22, 2025 14:39
Copy link
Member

@kecnry kecnry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well code looks simple enough - glad to see the diff is so small! Just need to do some thorough testing and see if there are any existing tickets we can close out with this and/or a bump of glue.

@kecnry
Copy link
Member

kecnry commented Jan 24, 2025

creating a spectral subset in specviz does not show the entry in the legend/data-menu with glue-dev (but does when reverting glue before the related upstream PR).

@rosteen
Copy link
Collaborator Author

rosteen commented Jan 24, 2025

creating a spectral subset in specviz does not show the entry in the legend/data-menu with glue-dev (but does when reverting glue before the related upstream PR).

You're right, I had tested spectral subsets in Cubeviz but apparently it's behaving differently in Specviz. Creating another subset triggers the previous one to show up, I remember encountering this before but thought it was resolved 🤔

@rosteen
Copy link
Collaborator Author

rosteen commented Jan 24, 2025

It seems like the layer hasn't been created yet when we're processing the SubsetCreateMessage in the data menu, but it's there when Plot Options is handling the message:

Finding Subset 1
updating items in <class 'jdaviz.configs.default.plugins.data_menu.data_menu.DataMenu'>
on subset created
Finding Subset 1
updating items in <class 'jdaviz.configs.default.plugins.data_menu.data_menu.DataMenu'>
on subset created
Finding Subset 1
Found layer: Subset 1
updating items in <class 'jdaviz.configs.default.plugins.plot_options.plot_options.PlotOptions'>

@rosteen rosteen force-pushed the extract-on-subset-create branch from c9cb48e to 51ae5cb Compare February 5, 2025 15:55
@rosteen rosteen merged commit 5c48b88 into spacetelescope:main Feb 12, 2025
20 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cubeviz no-changelog-entry-needed changelog bot directive plugin Label for plugins common to multiple configurations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants